/****************************************************************
(C) 2008 Kishore Nallan for DesignShack
http://www.kishorelive.com
kishore.nc@gmail.com
*****************************************************************/

var caja="";
function mostrarTecladoNum(id){
	caja=id.id;	
	document.getElementById("keyboard").style.display="block";
	document.getElementById("keyboardletra").style.display ="none";		
}

function mostrarTecladoLet(id){	
	caja=id.id;
	document.getElementById("keyboardletra").style.display="block";
	document.getElementById("keyboard").style.display ="none";		
}


window.onload=esconder;

function esconder() {
	document.getElementById("keyboard").style.display ="none";
	document.getElementById("keyboardletra").style.display ="none";	
	return true;	
}



$(document).ready(function(){
	var shifton = true;
	var i;
	for(i=0;i<4;i++) {
		var rowid = "#row" + i;
		$(rowid).hide();
		$(rowid).show();
	}

	// Desplegar el teclado
	$("#keyboard").draggable();	
	

	//Funcion que se realiza cunado una tecla se presiona
	$("#keyboard input").bind("click", function(e) {
		if( $(this).val() == 'Del' ) {
			$('#'+caja+'').replaceSelection("", true);
			}	
	
		
		else if( $(this).val() == 'Salir' ) {
			$('#showkeyboard').toogle();
			estado=0;
		}	
		
		else {		
		
			$('#'+caja+'').replaceSelection($(this).val(), true);	
		}
	});
	
	//Para letra
	$("#keyboardletra input").bind("click", function(e) {
		
			if( $(this).val() == 'Del' ) {
		$('#'+caja+'').replaceSelection("", true);
		}		
		
		else if( $(this).val() == 'Salir' ) {
			$('#showkeyboard').toogle();
			estado=0;
		}		
			
		else {	
			$('#'+caja+'').replaceSelection($(this).val(), true);	
		}
	});	
});